import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    location:{
      "name": "北京",
      "id": "101010100",
      "lat": "39.90498",
      "lon": "116.40528",
      "adm2": "北京",
      "adm1": "北京市",
      "country": "中国",
    },
    hour24:{
        fxTime: [], // x轴数据
        temp: [], // seriseData
    }
  },
  getters: {
  },
  mutations: {
    updateLocation(state,location){
        // state.location = location;
        // Object.assign(state.location,location)
        state.location = Object.assign({},location)
    },
    updateHour24(state,hour24){
      // state.hour24 = hour24
      Object.assign(state.hour24,hour24)
    },
  },
  actions: {
      updateLocationAction(context,location){
        context.commit("updateLocation",location)
    },
    updateLocation24Action(context,hour24){
      context.commit("updateHour24",hour24)
    },
  },
  modules: {
  }
})
